package com.pj.viewpager.adapter;


import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentPagerAdapter;

import java.util.List;

public class MyFragmentPagerAdapter extends FragmentPagerAdapter {


    List<Fragment> fragments;
    String[] title;

    public MyFragmentPagerAdapter(FragmentManager fm, int behavior, List<Fragment> fragments,String[] title) {
        super(fm, behavior);
        this.fragments = fragments;
        this.title = title;
    }


    @Override
    public Fragment getItem(int position) {
        return fragments.get(position);
    }

    @Override
    public int getCount() {
        return fragments.size();
    }



    @Override
    public CharSequence getPageTitle(int position) {
        return title[position];
    }
}
